package com.luoying.itew.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.luoying.itew.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ButtonItemViewTwo extends RelativeLayout {
    private static final String TAG = "ButtonItemView";
    @BindView(R.id.btn_text)
    TextView btnText;
    @BindView(R.id.lv_text)
    RelativeLayout lvText;
    @BindView(R.id.address_button_base)
    LinearLayout addressButtonBase;

    public ButtonItemViewTwo(Context context) {
        super(context);
        init();
    }

    public ButtonItemViewTwo(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    private void init() {
        View.inflate(getContext(), R.layout.button_item_two, this);
        ButterKnife.bind(this, this);
    }

    public void setText(String img) {
        //btnText.setText(img + "");
        if (img!=null){
            if (img.length()>5){
                btnText.setTextSize(11);
                btnText.setText(img);
            }else {
                btnText.setText(img);
            }
        }
    }

    public void setSelect() {
        lvText.setBackgroundResource(R.drawable.btn_city_select);
        btnText.setTextColor(getResources().getColor(R.color.white));

    }

    public void setNormal() {
        lvText.setBackgroundResource(R.drawable.btn_city_normal);
        btnText.setTextColor(getResources().getColor(R.color.gray));
    }

}
